package com.hostmann.corejava;

import java.awt.Toolkit;
import java.awt.event.ActionListener;
import java.util.Date;

public class TalkingClock {
    private int interval;
    private boolean beep;
    
    public TalkingClock (int aInterval, boolean aBeep) {
        interval = aInterval;
        beep = aBeep;
    }
    
    public class TimePrinter implements ActionListener {
        public void actionPerformed(Action event) {
            Date now = new Date();
            System.out.println("At the tone, the time is " + now);
            if (beep) Toolkit.getDefaultToolkit().beep();
        }
    }
}
